<template>
	<view class="container">
		<m-tabbar native>
		    <template v-slot:tabbar_index_1> 
		        <view class="custom_style">
		            <view class="custom_style_icon">+</view>
		        </view>
		    </template>
		</m-tabbar>
		<view class="header">
			<view class="head">
				<navigator url="/pages/search/search" hover-class="none" class="search"><uni-icons :style="{display:(tabIndex==1?'none':'block')}" class="icon" color="black" type="search" size="24" ></uni-icons></navigator>
				<view class="menu-type">
					<navigator v-for="(item,index) in menuList" @click="toPage(item.url)" class="item" hover-class="none">
						<view class="item" @click="handleTbas(index+1)" v-show="item.ifShow == 0" :class="tabIndex==index+1?'active':''">{{item.menuName}}</view>
					</navigator>
				</view>
				<view></view>
			</view>

			<view class="menu" v-if="layout!==1">

				<scroll-view scroll-x class="scroll-menu-list" >
					<view v-for="(item,index) in searchwordList " :key="index"  class="item" @click="queryByKey(item.keyword)" :class="{active:searchword==item.keyword||(searchword==''&&item.keyword=='全部')}">
						<view>{{item.keyword}}</view>
						<image class="imga" src="https://m.nocexpo.com/statics/js/modules/h5/img/banhu.png" mode="widthFix" />
					</view>

				</scroll-view>
			</view>
		</view>

    <!--关注内容-->
    <scroll-view v-if="layout==1" class="scroll-view" :class="[layout==1?'scroll-view1':''] " scroll-y @scrolltolower="onRefresh(1)" >
      <view class="attention " v-if="layout==1" style="background-color: #fff; padding-bottom: 10rpx;">
        <view class="title">
          你可能感兴趣的企业
          <view class="refresh" @click="getAtteList(1)">
            换一批
            <uni-icons class="icon" color=" #A1A0A0" type="refreshempty" size="18"></uni-icons>
          </view>
        </view>
        <view class="data">
          <view class="item" v-for="(item,index) in  attentionList" :key="index">
            <view class="left">
              <image class="avatar" :src="item.portrait?item.portrait:'https://m.nocexpo.com/statics/js/modules/h5/img/img13.png'" @click="toShowroom(item.id)"/>
              <view class="info">
                <view class="name">
                  {{item.userName}}{{item.followEachOther}}
                  <image class="img" src="https://m.nocexpo.com/statics/js/modules/h5/img/luo.png" mode="widthFix" />
                </view>

                <view class="desc">
                  <image class="img" src="https://m.nocexpo.com/statics/js/modules/h5/img/v.png" mode="widthFix" />
                  {{item.company}}
                </view>
              </view>
            </view>
            <view v-if="item.followEachOther == '3'" class="btn" @click="shoucang(item.id,true)">
              <uni-icons class="icon" color=" #ffffff" type="plusempty" size="12"></uni-icons> 关注
            </view>
            <view v-else class="btn btn1"  @click="shoucang(item.id,false)">
              已关注
            </view>
          </view>
        </view>
      </view>
      <view class="data-list">
        <custom-waterfalls-flow ref="waterfallsFlowRef1" :columnSpace="1.5" :key="1" :value="attenNewsList" @loaded="loadImg">
          <view  class="item" v-for="(item, index) in attenNewsList" :key="index" slot="slot{{index}}" @click="toDetial(item.id)">
            <view class="title">{{item.title}}</view>
            <view class="user">
              <view class="name">{{item.author.userName}}</view>
              <view class="num">
                <image class="imga" src="https://m.nocexpo.com/statics/js/modules/h5/img/redu.png" mode="widthFix" />
                {{item.likeCount}} 浏览
              </view>
            </view>
<!--            <image v-if="item.type==2" class="play" src="/static/image/video.png" mode="widthFix" />-->
<!--            <view v-else class="zhibo">
              <image src="/static/image/video.png" mode="widthFix" />
              直播回访
            </view>-->
<!--
            <navigator :url="index%2==0?'/pages/product/liveDetail/liveDetail':'/pages/product/vidoDetail/vidoDetail'" hover-class="none" class="url"></navigator>
-->
            <navigator :url="`/pages/product/imageText/imageText?id=${item.id}`" hover-class="none" class="url"></navigator>

          </view>
        </custom-waterfalls-flow>
      </view>
      <view class="data-hint">
        <hint  ref="hint"></hint>
      </view>
    </scroll-view>
		<!--推荐内容-->
    <scroll-view  v-if="layout==2" class="scroll-view" :class="[layout==2?'scroll-view1':''] " scroll-y @scrolltolower="onRefresh(2)">
			<view class="data-list">
				<custom-waterfalls-flow ref="waterfallsFlowRef2" :columnSpace="1.5" :key="2"  :value="list" @loaded="loadImg">
					<view  class="item" v-if="list.length" v-for="(item, index) in list" :key="index" slot="slot{{index}}">
						<view class="title">{{item.title}}</view>
						<view class="user">
              <img style="width: 36rpx;height: 36rpx;border-radius: 50%;margin-right: 0.10666667rem;" :src="item.author.portrait?item.author.portrait:'/static/image/wutouxiang.png'">
							<view class="name">{{item.author.userName}}</view>
							<view class="num">
                {{item.browseCount}} {{item.type==1? '浏览':'播放'}}
							</view>
						</view>
						<image v-if="item.type==2" class="play" :src="imgUrl + '/statics/js/modules/applet/img/video.png'" mode="widthFix" />
            <!--
            <view v-else class="zhibo">
							<image src="/static/image/video.png" mode="widthFix" />
							直播回访
						</view>
						-->
						<navigator :url="item.type==2?`/pages/product/vidoDetail/vidoDetail?id=` + item.businessId:`/pages/product/imageText/imageText?id=`+item.businessId" hover-class="none" class="url"></navigator>
					</view>
				</custom-waterfalls-flow>
			</view>
			<view class="data-hint">
				<hint  ref="hint"></hint>
			</view>
		</scroll-view>
    <!--直播内容-->
    <scroll-view v-if="layout==3" class="scroll-view" :class="[layout==3?'scroll-view1':''] " scroll-y @scrolltolower="onRefresh(3)">
      <view class="data-list">
        <custom-waterfalls-flow ref="waterfallsFlowRef3" :columnSpace="1.5" :key="3" :value="liveList" @loaded="loadImg">
          <view  class="item" v-for="(item, index) in liveList" :key="index" slot="slot{{index}}">
            <view class="title">{{item.title}}</view>
            <view class="user">
              <view class="name">{{item.company}}</view>
              <view class="num">
                <image class="imga" src="https://m.nocexpo.com/statics/js/modules/h5/img/redu.png" mode="widthFix" />
                {{item.watchNumber}}
              </view>
            </view>
            <view v-if="item.status==1" class="zhibo">
               <view class="icon"><text class="b-icon icon-zhibozhong"></text></view>
              直播预告
            </view>
            <view v-else-if="item.status==2" class="zhibo">
              <view class="icon"><text class="b-icon icon-yugao"></text></view>
              直播中
            </view>
            <view v-else class="zhibo">
             <view class="icon"><text class="b-icon icon-huifang"></text></view>
              直播回放
            </view>
            <navigator :url="`/pages/product/liveDetail/liveDetail?id=${item.userId}&roomId=${item.id}`" hover-class="none" class="url"></navigator>
          </view>
        </custom-waterfalls-flow>
      </view>
      <view class="data-hint">
        <hint  ref="hint"></hint>
      </view>
    </scroll-view>
    <!--视频内容-->
    <scroll-view v-if="layout==4" class="scroll-view" :class="[layout==4?'scroll-view1':''] " scroll-y @scrolltolower="onRefresh(4)">
      <view class="data-list">
        <custom-waterfalls-flow :columnSpace="1.5"  ref="waterfallsFlowRef4" :key="4" :value="videoList" @loaded="loadImg">
          <view  class="item" v-for="(item, index) in videoList" :key="index" slot="slot{{index}}">
            <view class="title">{{item.videoTitle}}</view>
            <view class="user">
              <view class="name">{{item.author.userName}}</view>
              <view class="num">
                <image class="imga" src="https://m.nocexpo.com/statics/js/modules/h5/img/redu.png" mode="widthFix" />
                {{item.browseCount}}  播放
              </view>
            </view>
            <image class="play" :src="imgUrl + '/statics/js/modules/applet/img/video.png'" mode="widthFix" />

            <navigator :url="`/pages/product/vidoDetail/vidoDetail?id=${item.id}`" hover-class="none" class="url"></navigator>
          </view>
        </custom-waterfalls-flow>
      </view>
      <view class="data-hint">
        <hint  ref="hint"></hint>
      </view>
    </scroll-view>

		<!--全局悬浮-->
		<suspension types="add"></suspension>
	</view>
</template>

<script>
import find from '@/api/find.js';
import commonApi from '@/utils/commonMethod.js';
import commonMethod from '@/utils/commonMethod.js';
import indexApi from '@/utils/request/index.js';

//瀑布流文档：https://ext.dcloud.net.cn/plugin?id=7594
export default {
	data() {
		return {
			  refreshStatus:true,
					layout:2,
					tabIndex:2,
					list: [],
			  listNew:[``],
			  videoShow:false,
			  video:'',
			  register: false,//登录
			  text:'推荐',
			  searchStr:"",
			  search: {
				page: 1,
				limit: 10,
				search: '',
				lastpage: 0,
			  },
			  active:0,
			  actived:'',
			  searchword:'',
			  searchwordList: [{id:1,keyword:"2323"},{id:2,keyword:"2323"}],// 原 tabList 数组内容
			  tabList:["全部","机床","刀具","激光设备","附件","全部","机床","刀具","激光设备","附件"],
			  list2:["关注","推荐","直播","视频"],
			  lists:[],
			  release:false,
			  shade:false,
			  issue:false,
			  resList:[],
			  productList: [],
			  productListDivShow: false,
			  tuijianchanpinDivShow: true,
			  tuijianxuqiuDivShow: true,
			  searchProductLoading: true,
			  searchProductNoMore: false,
			  noDataShow: false,
			  bannerImg: [],
			  notices:[],
			  tuijianProductList: [],
			  tuijianxuqiuList: [],
			  indexBannerShow: true,
			  indexNoticeShow: false,
			  bannerShow: true,
			  searchListShow: false,
			  searchListShow1: false,
			  searchFocusState: false,
			  searchShow: true,
			  searchKeyList: [],
			  searchProductClassifyList: [],
			  userCloudHomeVoList: [], //展商列表
			  liveUsers: [],//直播商家列表
			  defaultZhiBoImg: '',
			  videoList: [],//视频列表
			  videoList1:[],//视频列表
			  videoList2:[],//视频列表
			  liveList: [],//直播列表
			  newsList1: [],
			  newsList2: [],
			  attenNewsList:[],
			  attenNewsList1: [],//关注列表
			  attenNewsList2: [],//关注列表
			  isShowLive: false,//是否显示直播
			  isShowVideo: false,//是否显示视频
			  swiperShow: true,
			  seo: '',
			  pcpop: true, //pc遮罩层
			  activeIndex: 1,//默认标签页

			  liveSearch: {
				page: 0,
				limit: 10,
				search: '',
				lastpage: 0,
				totalPage: '',
				totalCount: '',
				loading:false,
				noMore:false
			  },
			  videoSearch: {
				page: 0,
				limit: 10,
				search: '',
				lastpage: 0,
				totalPage: '',
				userId: '',
				totalCount: '',
				loading:false,
				noMore:false
			  },
			  pageMore:{
				loading: false,//正在加载
				noMore: false,//没有更多数据
				noData: false,//没有数据
				complete: true, //数据加载完成
			  },
			  newsSearch: {
				page: 0,
				limit: 10,
				totalPage: '',
				totalCount: '',
				search:'',
				loading:false,
				noMore:false
			  },
			  newsLine: {
				loading: false,//正在加载
				noMore: false,//没有更多数据
				noData: false,//没有数据
			  },
			  currentUser: {
				ifAtteOfficialAccounts:1
			  },
			  atteNewsList:[],
			  atteNewsSearch: {
				page: 1,
				limit: 10,
				totalPage: '',
				totalCount: '',
				userId:'802728',
				loading: false,//正在加载
				noMore: false,//没有更多数据
			  },
			  atteNewsLine: {
				loading: false,//正在加载
				noMore: false,//没有更多数据
				noData: false,//没有数据
			  },
			  attentionList: [],
			  atteSearch: {
				page: 1,
				lastpage: 0,
				limit: 3,
				noMore: false,
				totalPage: '',
				userId: ''
			  },
			  AtteNewsScroll:0,
			  newsScroll:0,
			  videoScroll:0,
			  liveScroll:0,
			  coalesceList:[],//聚合列表
			  productSearch: {
				page: 1,
				limit: 10,
				search: '',
				lastpage: 0,
				totalPage: '',
				totalCount: ''
			  },
			  productLine: {
				loading: false,//正在加载
				noMore: false,//没有更多数据
				noData: false,//没有数据
			  },
			  compList: [],
			  compSearch: {
				page: 1,
				limit: 10,
				search: '',
				lastpage: 0,
				totalPage: '',
				totalCount: ''
			  },
			  compLine: {
				loading: false,//正在加载
				noMore: false,//没有更多数据
				noData: false,//没有数据
			  },
			  showAddress: '',
			  scroll:'',
			  Topscroll:false,
			  pageLocation:'',
			  timer:'',
			  liveTime:'',
			  indexUrl:0,
			  numberUrl:0,
			  index_number:'',
			  userId:'',
			  roomId:'',
			  
			  share_title:'发现',
			  share_desc:'',
			  share_url:'',
			  pageShareConfiglist:[],
			  
			  startTime:'', //进入页面时间
			  endTime:'',//离开页面时间
			  imgUrl: indexApi.baseUrl,
			  menuList: []
	
		};
	},
  async onload(){
    const configList = await commonMethod.getConfig()
    this.configs = configList.data.list;
    for (var i = 0; i < this.configs.length; i++) {
      if (this.configs[i].paramKey == "find_to_skip") {
        this.config = this.configs[i].paramValue;
        if(0 != this.configs[i].paramValue){
          uni.navigateTo({
            url:this.configs[i].paramValue
          })
        }
        break;
      }
    }
  },
  async onShow() {
	  await this.getFindMenu();
    const configList = await commonMethod.getConfig()
    this.configs = configList.data.list;
    for (var i = 0; i < this.configs.length; i++) {
      if (this.configs[i].paramKey == "find_to_skip") {
        this.config = this.configs[i].paramValue;
        if(0 != this.configs[i].paramValue){
          uni.navigateTo({
            url:this.configs[i].paramValue
          })
        }
        break;
      }
    }
		// 获取当前小程序的页面栈
		let pages = getCurrentPages();
		// 数组中索引最大的页面--当前页面
		let currentPage = pages[pages.length - 1];
		//首页点击直播，直接定位到直播
		if(currentPage.options && currentPage.options.tabIndex){
			let index = parseInt(currentPage.options.tabIndex);
			this.tabIndex = index;
			this.layout = index;
		}else{
			//默认展示推荐内容
			this.tabIndex = 2
			this.layout = 2
		}
		this.$refs.hint.setStatus("loading");
		this.handleTbas(this.tabIndex);
		commonApi.getPageShareConfig().then(res =>{
			this.pageShareConfiglist = res.data.list
		})
		setTimeout(()=> {
			if (getApp().globalData.onShow) {
				getApp().globalData.onShow = 0;
				console.log("demo前后台切换之切到前台")
			}
			else {
				console.log("demo页面被切换显示")
				this.startTime = +new Date();
			}
		}, 100);
	},
	onHide(){
		setTimeout(() => {
			var that = this
			if (getApp().globalData.onHide) {
				getApp().globalData.onHide = 0;
				console.log("还在当前页面活动")
			}
			else {
				that.endTime = +new Date();
				console.log("demo页面停留时间：" + (that.endTime - that.startTime))
				var stayTime = Math.round((that.endTime - that.startTime)/1000);
			   //这里获取到页面停留时间stayTime，然后了可以上报了
			   this.saveFootPrint(stayTime);
			}
		}, 100)
	},

	async mounted() {
		await this.getCurrentUser()
		await this.getSearchProductClassify();
		const pages = getCurrentPages()
		const currentPage =pages[pages.length - 1]
		this.share_url = currentPage.$page.fullPath
		await this.getCurrentPageConfig();
	},
	onShareAppMessage: function (options) {//分享

		return {
			title: this.share_title,
      path: this.share_url + "?sourceUserId=" + uni.getStorageSync("userId"),
			desc: this.share_desc,
			imageUrl: 'https://m.nocexpo.com/statics/js/modules/h5/img/logo1.png',
			success: function (res) {
				console.info(res + '成功');
				wx.showToast({
					title: '分享成功',
				})
				// 转发成功
			},
			fail: function (res) {
				console.log(res + '失败');
				// 转发失败
			},
		 
		}
		
		
	 },
	/*分享朋友圈 */
	onShareTimeline: function() {
		return {
			title: '发现',
      query: 'sourceUserId=' + uni.getStorageSync("userId"),
			imageUrl: 'https://m.nocexpo.com/statics/js/modules/h5/img/logo1.png',
		}
	},

	methods: {
		saveFootPrint(stayTime){
			commonMethod.saveFootPrint(this.currentUser.id,this.startTime,stayTime,this.share_url,"发现")
		},
		getFindMenu(){
			commonMethod.getFindMenu(2).then(res =>{
				this.menuList = res.data.list				
			})
		},
		handleTbas(index){
			this.layout=index;
			this.tabIndex=index;
			  switch (index){
				case 1 : this.getAtteNewsList(1);break;
				case 2 : this.getNewsList(1); break;
				case 3 : this.getLiveList(1);break;
				case 4 : this.queryVideo(1);break;
			  }
			  this.getCurrentPageConfig()
		},
		getCurrentPageConfig(){
			this.pageShareConfiglist.forEach((value, index, array) => {
				if(this.tabIndex == 2){
					this.share_title = '动态-金诺云展'
					this.share_desc = '点击进入看更多企业动态，机械加工行业采购对接平台'
					if (value.pageParam.includes("guanzhu_recommend")) {
						if (value.shareTitleConfig != null && value.shareTitleConfig != '') {
							this.share_title = value.shareTitleConfig
						}
						if (value.shareDescConfig != null && value.shareDescConfig != '') {
							this.share_desc = value.shareDescConfig
						}
					}
				}else if(this.tabIndex == 3){
					this.share_title = '直播厅-金诺云展'
					this.share_desc = '点击进入看更多企业直播，机械加工行业采购对接平台'
					if (value.pageParam.includes("guanzhu_live")) {
						if (value.shareTitleConfig != null && value.shareTitleConfig != '') {
							this.share_title = value.shareTitleConfig
						}
						if (value.shareDescConfig != null && value.shareDescConfig != '') {
							this.share_desc = value.shareDescConfig
						}
					}
				}else if(this.tabIndex == 4){
					this.share_title = '视频-金诺云展'
					this.share_desc = '点击进入看更多企业视频，机械加工行业采购对接平台'
					if (value.pageParam.includes("guanzhu_video")) {
						if (value.shareTitleConfig != null && value.shareTitleConfig != '') {
							this.share_title = value.shareTitleConfig
						}
						if (value.shareDescConfig != null && value.shareDescConfig != '') {
							this.share_desc = value.shareDescConfig
						}
					}
				}
			})
		},
		//关注页面
		getAtteNewsList(page) {
		  if(page){
			this.atteNewsSearch.page=page;
			this.atteNewsSearch.noMore = false;
		  }
		  //正在加载,或者没有数据则返回
		  if(this.atteNewsSearch.loading||this.atteNewsSearch.noMore){
			return;
		  }else{
			//this.atteNewsSearch.loading=true;
		  }
		  find.getAtteNews(this.atteNewsSearch).then(res => {
			this.atteNewsSearch.page ++;
			res = res.data.page;
			this.atteNewsSearch.totalCount = res.totalCount;
			this.atteNewsSearch.totalPage = res.totalPage;
			//下一页
			if(res.list.length>0){
			  if(page==1){
				//刷新必须重置一下
				this.$refs.waterfallsFlowRef1.refresh();
				this.attenNewsList = res.list;
			  }else{
				this.$refs.hint.setStatus('loading');
				this.attenNewsList = [...this.attenNewsList,...res.list];
			  }

			}else{
			this.$refs.hint.setStatus('loadingComplete');
			  this.atteNewsSearch.noMore=true;
			}
			//没有推荐列表再查询
			if(this.attentionList.length==0){
			  if(this.list.length == 0){
				//查询关注列表
				this.atteSearch.limit = 3;
				this.getAtteList(1);
			  }else{
				this.atteSearch.limit = 3;
				this.getAtteList(1);
			  }
			}
		  })
		}
		//推荐关注列表
		,getAtteList(){
		  find.getAtteList(this.atteSearch).then(res => {
			res = res.data.page;
			this.atteSearch.totalCount = res.totalCount;
			this.atteSearch.totalPage = res.totalPage;
			this.attentionList = res.list;
			this.atteSearch.page++;
		  })
		},
		//推荐
		getNewsList(page) {
		  if(page){
			this.newsSearch.page=page;
		  }
		  //正在加载,或者没有数据则返回
		  if(this.newsSearch.loading||this.newsSearch.noMore){
			return;
		  }else{
			this.newsSearch.loading=true;
		  }
		  //获取推荐列表
		  find.getKeywordCoalesce(this.newsSearch).then(res=>{
			res=res.data.page;
			this.newsSearch.page++;
			if(!(res && res.records)){
			  return;
			}
			//下一页
			if(res.records.length>0){
			  this.pageMore.noMore = false;
			}else{
			  this.newsSearch.noMore = true;
			  this.$refs.hint.setStatus('loadingComplete');
			}
			res.records.filter(v=>v).forEach(value=>{
			  //2视频
			  if(value.type==2){
				value.title= value.videoTitle;
				value.author = value.videoAuthor;
			  }else{
				//1图文
				value.image=value.pictureUrl;
			  }
			  //做着为空，这只默认值
			  if (!value.author){
				value.author = {userName:'',portrait:''}
			  }
			  value.countName = value.type==1?"浏览":"播放";

			})
			this.newsSearch.totalCount = res.totalCount;
			this.newsSearch.totalPage = res.totalPage;
			for (var i = 0; i < res.records.length; i++) {
			  // 用户名超过6字符用...代替
			  if(res.records[i]&&res.records[i].author != null){
				if(res.records[i].author.userName != null){
				  if(res.records[i].author.userName.length > 6){
					res.records[i].author.userName = res.records[i].author.userName.substring(0,6);
				  }
				}
			  }
			  if(res.records[i]&&res.records[i].videoAuthor != null){
				if(res.records[i].videoAuthor.userName != null){
				  if(res.records[i].videoAuthor.userName.length > 6){
					res.records[i].videoAuthor.userName = res.records[i].videoAuthor.userName.substring(0,6);
				  }
				}
			  }
			}
			if(page ==1){
			  //刷新必须重置一下
			  this.$refs.waterfallsFlowRef2.refresh();
			  this.list=res.records;
			  this.newsSearch.noMore=false;
			}else{
			  this.list = this.list.concat(res.records);
			  this.$refs.hint.setStatus('loading');
			}
		  });
		},

		//查询直播
		getLiveList(page) {
		  if(page){
			this.liveSearch.noMore = false;
			this.liveSearch.page=page;
		  }
		  //正在加载,或者没有数据则返回
		  if(this.liveSearch.loading||this.liveSearch.noMore){
			return;
		  }else{
			this.liveSearch.loading=true;
		  }

		  find.searchLive(this.liveSearch).then(res => {
			this.liveSearch.page ++;
			res = res.data.page;
			res.list.forEach(e=>{
			  e.image=e.fengmianImgUrl;
			});
			this.liveSearch.totalCount = res.totalCount;
			this.liveSearch.totalPage = res.totalPage;
			if(page == 1){
			  //刷新必须重置一下
			  this.$refs.waterfallsFlowRef3.refresh();
			  this.liveList = res.list;
			}else{
			  this.$refs.hint.setStatus('loading');
			  this.liveList = [...this.liveList,...res.list];
			}
			if(res.currPage >= res.totalPage){
			  this.$refs.hint.setStatus('loadingComplete');
			  this.liveSearch.noMore = true;
			}
		  })
		}//查询视频
		,queryVideo(page){
		  if(page){
			this.videoSearch.page=page;
			this.videoSearch.noMore = false;
		  }
		  //正在加载,或者没有数据则返回
		  if(this.videoSearch.loading||this.videoSearch.noMore){
			return;
		  }else{
			this.videoSearch.loading=true;
		  }
		  find.getVideoList(this.videoSearch).then(res => {
			this.videoSearch.page ++;
			this.videoSearch.totalCount = res.totalCount;
			this.videoSearch.totalPage = res.totalPage;
			res = res.data.page;
			res.list.forEach(e=> {
			  e.image = e.coverImg ? e.coverImg : (e.videoUrl + '?x-oss-process=video/snapshot,t_7000,f_jpg,m_fast');
			})
			if(page==1){
			  //刷新必须重置一下
			  this.$refs.waterfallsFlowRef4.refresh();
			  this.videoList = res.list;

			}else{
			  this.$refs.hint.setStatus('loading');
			  this.videoList =[...this.videoList,...res.list];
			}

			if(res.currPage>=res.totalPage){
			  this.$refs.hint.setStatus('loadingComplete');
			  this.videoSearch.noMore = true;
			}
		  })
		},
		async getCurrentUser(){
		  commonApi.currentUserAxios().then(res =>{
			this.currentUser = res.data.session_user_h5;
		  });
		},
		doSortAtteNewsList(index, list) {
		  console.log("历史的："+this.list.length);
		},
		//通过关键字搜索
		queryByKey(key ){
		  if('全部'==key){
			key='';
		  }
		  this.searchword=key;
		  this.atteNewsSearch.loading=false;
		  this.newsSearch.loading=false;
		  this.liveSearch.loading=false;
		  this.videoSearch.loading=false;
		  switch (this.layout){
			case 1 : this.newsSearch.search=key;break
			case 2 : this.newsSearch.search=key; break;
			case 3 : this.liveSearch.search=key;break;
			case 4 : this.videoSearch.search=key;break;
		  }
		  switch (this.layout){
			case 1 :this.getAtteNewsList(1);break;
			case 2 : this.getNewsList(1); break;
			case 3 : this.getLiveList(1);break;
			case 4 : this.queryVideo(1);break;
		  }
		},
		//获取查询条件
		getSearchProductClassify(){
		  find.getSearchProductClassify().then(res =>{
			this.searchwordList = res.data.list
			this.searchwordList.unshift({
			  id:0,
			  keyword:'全部',
			  sort:null
			})
		  });

		},
		onRefresh(i){
		  console.log("我到底了"+i);
		  switch (i){
			case 1 :this.getAtteNewsList();break;
			case 2 : this.getNewsList(); break;
			case 3 : this.getLiveList();break;
			case 4 : this.queryVideo();break;
		  }

		},
		shoucang(userId,flag){
		  find.attention(userId,flag).then(a=>{
			  this.attentionList.forEach(e=>{
				if(e.id == userId){
				  e.followEachOther= flag ?'2':'3';
				}
				//3未收藏，2收藏

			  })

		  });
		},
		toDetial(id){
		  commonMethod.toImageText(id);

		},
		toShowroom(id){
			uni.navigateTo({
				url:'/pages/product/showroom/showroom?userId=' + id,
			})
		},loadImg(){
		  this.atteNewsSearch.loading=false;
		  //设置加载完毕
		  this.newsSearch.loading=false;
		  //设置加载完毕
		  this.newsSearch.loading=false;
		  this.liveSearch.loading=false;
		  this.videoSearch.loading=false;
		  console.log("加载完图片");
		}


	}
};
</script>

<style lang="scss" scoped>
	.container{
		height: auto;
	}
.header {
	background-color: #fff;
	padding-bottom: -15 + $interval;
	.head {
		display: flex;
    height: 76rpx;
		align-items: center;
		justify-content: space-between;
		.search {
      width: 24px;
      height: 24px;
			padding: -5 + $interval;
		}
		.menu-type {
			display: flex;
			align-items: center;
			.item {
				font-size: $font-size-max + 2;
				margin: 0px 16rpx;
			}
			.active {
				font-weight: 600;
				font-size: 40rpx;
			}
		}
	}

	.menu {
		margin-left: $interval;
	}
}
  .attention {
    padding: 0rpx $interval 0px;
    .title {
      display: flex;
      justify-content: space-between;
      font-size: $font-size-max;
      .refresh {
        color: #a1a0a0;
        display: flex;
        font-size: $font-size;
        align-items: center;
      }
    }
    .data{
      margin-top: $interval;
      .item{
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 40rpx;
        .left{
          display: flex;
          align-items: center;
          .avatar{
            width: 92rpx;
            height: 92rpx;
            border-radius: 50%;
          }
          .info{
            margin-left: 20rpx;
            .name{
              display: flex;
              font-size:$font-size-max;
              font-weight: 600;;
              align-items: center;
              .img{
                margin-left: 15rpx;
                width: 40rpx;
                height: 40rpx;
              }
            }
            .desc{
              margin-top: 10rpx;
              display: flex;
              align-items: center;
              .img{
                height: 32rpx;
                width: 32rpx;margin-right: 15rpx;
              }
            }
          }
        }
        .btn{
          width: 116rpx;
          height: 52rpx;
          background: #00AAA6;
          border-radius: 26rpx;
          color: #fff;
          font-size: $font-size-min;
          display: flex;
          align-items: center;
          justify-content: center;
        }
        .btn1{height: 50rpx;
          color: #A1A0A0;
          background: none;
          border: 1rpx solid #A1A0A0;
        }

			}
		}
	}
	.menu {
		margin-left: $interval;
	}


.scroll-view {
	height: calc(100vh - 200rpx);
	.data-list {
		padding: 18rpx 18rpx 0px;
	    .url{
			position: absolute;
			width:100%;
			height: 100%;
			z-index: 30;
			left:0px;
			top:0px;
		}
		.play {
			position: absolute;
			right: 20rpx;
			top: 20rpx;
			width: 40rpx;
			height: 40rpx;
			z-index: 33;
		}
		.zhibo {
			position: absolute;
			right: 20rpx;
			top: 20rpx;
			line-height: 40rpx;
			z-index: 33;
			background: rgba(0, 0, 0, 0.5);
			color: #fff;
			display: flex;
			font-size: $font-size-min;
			border-radius: 20rpx;
			padding-right: 25rpx;
			overflow: hidden;
			.icon{
				background: #00B7B3;
				width: 40rpx;
				height: 40rpx;
				display: flex;
				padding-left: 10rpx;
				align-items: center;
				border-radius: 20rpx;
				margin-right: 20rpx;
				text{
					font-size: 24rpx;
				}
			}
			
		}
		.item {
			padding: $interval-min;
			.title {
				display: flex;
				-webkit-line-clamp: 2;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.user {
				display: flex;
				font-size: $font-size-min;
				align-items: center;
				margin-top: 20rpx;
				color: $text-color-grey;
				.name {
					flex: 1;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}
				.num {
					display: flex;
					align-items: center;
					margin-left: $interval;
					.imga {
						width: 20rpx;
						margin-right: 10rpx;
					}
				}
			}
		}
	}
	.data-hint{
			margin-top: -24rpx;
		}
}
.scroll-view1{
	height: calc(100vh - 150rpx);
}
</style>
